//
//  DSYBLButton.m
//  BLDMusics
//
//  Created by dllo on 16/3/24.
//  Copyright © 2016年 李晓丹. All rights reserved.
//

#import "DSYBLButton.h"

@implementation DSYBLButton

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self creatSubviews];
    }
    return self;
}

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self creatSubviews];
    }
    return self;
}

- (void)creatSubviews {
    self.buttonIcon = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 40, 40)];
    [self addSubview:_buttonIcon];
    
    self.buttonTitle = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_buttonIcon.frame) + 5, CGRectGetMinY(_buttonIcon.frame), self.frame.size.width - CGRectGetMaxX(_buttonIcon.frame) - 15, CGRectGetHeight(_buttonIcon.frame) / 2)];
    self.buttonTitle.textColor = [UIColor whiteColor];
    [self addSubview:_buttonTitle];
    
    self.buttonDetail = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMinX(_buttonTitle.frame), CGRectGetMaxY(_buttonTitle.frame), CGRectGetWidth(_buttonTitle.frame), CGRectGetHeight(_buttonTitle.frame))];
    _buttonDetail.font = [UIFont systemFontOfSize:13.0f];
    _buttonDetail.textColor = [UIColor lightGrayColor];
    [self addSubview:_buttonDetail];
}


- (void)installImage:(NSString *)imageName Title:(NSString *)title Detail:(NSString *)detail
{
    self.buttonIcon.image = [UIImage imageNamed:imageName];
    self.buttonTitle.text = title;
    self.buttonDetail.text = detail;
}

@end
